package com.backstage.web;

import com.backstage.pojo.dto.Message;

import com.backstage.pojo.vo.SysUserVo;
import com.backstage.service.SysUserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class SysUserController {
    @Autowired
    SysUserService sysUserService;

    @GetMapping("/sysuser")
    public Message<List<SysUserVo>> findList(SysUserVo sysUserVo) {
        return sysUserService.list(sysUserVo);
    }

    @RequestMapping(value = "/sysusers", method = RequestMethod.GET)
    public Message<SysUserVo> get(Long id) {
        return sysUserService.get(id);
    }

    @RequestMapping(value = "/sysusers/sysuser", method = RequestMethod.PUT)
    public Message<SysUserVo> add(SysUserVo sysUserVo) {
        return sysUserService.add(sysUserVo);
    }

    @RequestMapping(value = "/sysusers/sysuser", method = RequestMethod.POST)
    public Message<SysUserVo> update(SysUserVo sysUserVo) {
        return sysUserService.edit(sysUserVo);
    }

    @RequestMapping(value = "/sysusers/sysuser/{id}", method = RequestMethod.DELETE)
    public Message<SysUserVo> delete(@PathVariable Long id) {
        return sysUserService.delete(id);
    }
}